package StudyCode.summary.mycollection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class MethodToConvertAArrayCollectionOfIntToAArrayCollectionOfInteger {
	@SuppressWarnings("unchecked")
	public static <T> T[] toObject(Object... objArray) {
		if (objArray == null)
			return null;
		else if (objArray[0].getClass() == int.class) {
			if (objArray.length == 0)
				return (T[]) new Integer[0];
			final Integer[] result = new Integer[objArray.length];
			for (int i = 0; i < objArray.length; i++) {
				result[i] = (Integer) objArray[i];
			}
			return (T[]) result;
		} else
			return null;
	}
}
